#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
int a[105][105];
int sum[105][105];
namespace my
{
	int x1;
	int x2;
	int y1;
	int y2;
};
int main()
{
	int n; int area = 0;
	std::cin >> n;
	for (int i = 1; i <= n; ++i)
	{
		std::cin >> my::x1 >> my::y1 >> my::x2 >> my::y2;
		a[my::x1+1][my::y1+1]++;
		a[my::x2+1][my::y1+1]--;
		a[my::x1+1][my::y2+1]--;
		a[my::x2+1][my::y2+1]++;
	}
	for (int i = 1; i <= 100; ++i)
	{
		for (int j = 1; j <= 100; ++j)
		{
			sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + a[i][j];
			if (sum[i][j] > 0)
			{
				area++;
			}
		}
	}
	
	std::cout << area << std::endl;
	
	return 0;
}